home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0184.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  817 b   |  31 lines

  1. Hello!
  2.  
  3.  > Yeah, sorry about that.  I'm not great with sorting algorithms.  I've been
  4.  > told that a flag would be a good idea, but I'm not sure how to implement
  5.  > it. How about an updated algorithm?
  6.  
  7. A sorting algorithm with a flag is done in this way.
  8.  
  9. Repeat
  10.    FLAG=False
  11.    For T=1 to N
  12.       If A(T)>A(T+1)
  13.          Swap A(T),A(T+1)
  14.          FLAG=True
  15.       End If
  16.    Next
  17. Until Not FLAG
  18.  
  19. ...well, actually I have no time now to see if I did stupid mistakes.
  20. Moreover you can implement the check (>) and the swap routine as you need
  21. them.
  22.  
  23. Bye
  24.  
  25.     berionne@flashnet.it                       >>Flagger<<
  26.   +---------------------------------------------------------------+
  27.   |   BASIC programmers never die, they GOSUB and don't RETURN.   |
  28.   +---------------------------------------------------------------+
  29.  
  30.  
  31.